import { defHttp, jsonHttp } from '@/utils/http/axios';
import {
  chatidParams,
  deptListParams,
  deptUserListParams,
  integralListParams,
  rankingListParams,
} from './model/deptModel';
import { BasicListResult, BasicDataResult } from '../model/baseModel';

import { ErrorMessageMode } from '#/axios';
import { saveParams } from '@/api/sys/model/userModel';

enum Api {
  //Login = '/login',
  rewardsList = '/hl/sys/rewards/rewardsList',
  rewardsSelectList = '/hl/sys/rewards/rewardsSelectList',
  importUserRewardsExcel = '/hl/sys/rewards/importUserRewardsExcel',
  saveRewards = '/hl/sys/rewards/saveRewards',
  rewardsDetail = '/hl/sys/rewards/rewardsDetail',
  rewardsDelete = '/hl/sys/rewards/rewardsDelete',
  userRewardsList = '/hl/sys/rewards/userRewardsList',
  saveUserRewards = '/hl/sys/rewards/saveUserRewards',
  userRewardsDetail = '/hl/sys/rewards/userRewardsDetail',
}

/**
 * @description: user login api
 */
export function rewardsListApi(params: deptListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.rewardsList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function rewardsSelectListApi(params: deptListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.rewardsSelectList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function saveRewardsApi(params: deptUserListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.saveRewards,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function rewardsDetailApi(params: deptUserListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.rewardsDetail,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function rewardsDeleteApi(params: chatidParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.rewardsDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function importUserRewardsExcelApi(params: saveParams, mode: ErrorMessageMode = 'modal') {
  // jsonHttp defHttp
  return jsonHttp.post<BasicDataResult>(
    {
      url: Api.importUserRewardsExcel,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function userRewardsListApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.userRewardsList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function saveUserRewardsApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.saveUserRewards,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function userRewardsDetailApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.userRewardsDetail,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
